package com.guochenglang.www.dao;

import com.guochenglang.www.pojo.Traces;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface TracesDao {
    /**
     * 搜索浏览记录
     *
     * @param traces 搜索条件
     * @return 搜索列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Traces> tracesSelect(Traces traces) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 分页获取浏览记录
     *
     * @param page   当前页码
     * @param num    每页显示个数
     * @param traces 搜索条件
     * @param order  排序条件
     * @param mode   升序还是降序
     * @return 浏览记录
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Traces> tracesSelectByLimit(int page, int num, Traces traces, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 添加浏览记录
     *
     * @param traces 浏览记录信息
     * @return 添加的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    int insertTraces(Traces traces) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 删除浏览记录
     *
     * @param traces 删除条件
     * @return 删除行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    int deleteTraces(Traces traces) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;
}
